#@adminLayout() #define main()


<script src="#(ctx)/static/js/jquery.bootstrap.newsbox.min.js"></script>

<style type="text/css">
	.demo2{height:auto;}
	.demo2 li{line-height:40px;}
	
	.text-center{
		border-radius:10px;
		background:#1c84c6;
		padding:10px 0px;
		color:#ffffff;
		cursor:pointer;
	}
	.text-center a{
		color:#ffffff;
	}
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
        	
        	<!-- <div class="col-sm-2">
        		
        	</div> -->
        	<div class="col-sm-2">
        		<div class="items text-center" style="background:#5cb85c"  onclick="$.modal.openTab('公告','#(ctx)/w_notice_sel')">
        			<h3>公告</h3>
	            </div>
        	</div>
        	
        	<div class="col-sm-2">
        		<div class="items text-center" style="background:#5bc0de"  onclick="$.modal.openTab('提醒','#(ctx)/w_notask_edit')">
            	<h3>提醒</h3>
            	</div>
        	</div>
        
        	<div class="col-sm-2">
        		<div class="items text-center" style="background:#7266ba"  onclick="$.modal.openTab('待处理隐患','#(ctx)/run_trouble_lib?cflag=9')">
            	<h3>待处理隐患</h3>
            	</div>
        	</div>
        
        	<div class="col-sm-2">
        		<div class="items text-center"  onclick="$.modal.openTab('当日计划','#(ctx)/produce_list_cx?dotype=noday')">
            	<h3>当日计划</h3>
            	</div>
        	</div>
        	
        	<div class="col-sm-2">
        		<div class="items text-center" style="background:#6b2c25"  onclick="$.modal.openTab('工作推送','#(ctx)/w_work_ts')">
        			<h3>工作推送 </h3>
	            </div>
        	</div>
        </div>
        <div class="col-sm-6" style="height:350px;margin-top:15px;">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>待办任务</h5>
                </div>
                <div class="ibox-content" style="padding:0px;margin:0px;">
                    <table id="dg1" data-mobile-responsive="true"></table>
                </div>
            </div>
        </div>
         <div class="col-sm-6" style="height:350px;margin-top:15px;">
        	<div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>推送的工作计划</h5>
                </div>
                <div class="ibox-content" style="padding:0px;margin:0px;">
                    <table id="dg_plan" data-mobile-responsive="true"></table>
                </div>
            </div>
        </div>
     
        
          <div class="col-sm-6" style="height:350px;margin-top:15px;">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>严重及危急隐患</h5>
                    <span style="float:right"><a href="javascript:void(0)" onclick="openMore()">更多</a></span>
                </div>
                <div class="ibox-content" style="padding:0px;margin:0px;">
                    <!-- <table id="dg2" data-mobile-responsive="true"></table> -->
                    <ul class="demo2">
                    
					</ul>
                </div>
            </div>
        </div>
       
       <div class="col-sm-6" style="height:350px;margin-top:15px;">
        	<div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>今日计划</h5>
                     <span style="float:right"><a href="javascript:void(0)" onclick="openMore_work()">更多</a></span>
                </div>
                <div class="ibox-content" style="padding:0px;margin:0px;">
        			<table id="dg_work" data-mobile-responsive="true"></table>
                </div>
            </div>
        </div>
       
       
     </div>
     <div class="row" style="margin-top:15px;padding:0px;">
        <div class="col-sm-9">
        	<div id="container-map">
			 <!-- 	<iframe src="#(ctx)/map_line" style="width:100%;height:500px"></iframe>  -->
			</div>
        </div>
       
     </div>
 </div>
 
 
<style type="text/css">
	.bootstrap-table .fixed-table-toolbar{display:none}
	table thead{display:none;}
</style>

<script type="text/javascript">
	var posts='#(posts)';
	var prefix = "#(ctx)/tomain";
	$(function(){
		$(".demo2").bootstrapNews({
            newsPerPage: 5,
            autoplay: true,
			pauseOnHover: true,
			navigation: false,
            direction: 'down',
            newsTickerInterval: 1500,
            onToDo: function () {
            }
        });
		bindTask();
		bindPlan();
		lineWork();
	});
	//绑定待办工作流程
	function bindTask()
	{
		var options = {
			id:"dg1",
	        url: prefix + "/getTaskList",
            uniqueId: "ctask_id",
            sortName: "wfname",
            sortOrder: "asc",
            modalName: "我的工作",
            pageSize:5,
            showSearch: false,
            showRefresh: false,
            showColumns: false,
            showToggle: false,
            columns: [
                {
                    title:'操作',
                    align: 'center',
                    width: '60px',
                    formatter:rowformater
                },
               {
                   title:'任务',
                   field: 'ctask_desc'
               }],
               onLoadSuccess:function(){
            	   
               }
	    };
	    $.table.init(options);
	}
	
	var index="";
	function bindPlan()
	{
	
		var options = {
			id:"dg_plan",
	        //url: prefix + "/getPlan",
	        url: prefix + "/getTstask",
            uniqueId: "cprj",
            sortName: "dt",
            sortOrder: "asc",
            modalName: "推送的工作",
           pageSize:5,
           showSearch: false,
            showRefresh: false,
            showColumns: false,
            showToggle: false,
            pagination: false,
            columns: [
                {
                    title:'操作',
                    align: 'center',
                    width: '60px',
                    formatter:rowformaterT
                },
               {
                   title:'推送工作内容',
                   field: 'ccontent',
                   width: '400px',
               }/* ,
               {
                   title:'推送时间',
                   field: 'dt'
               } */
               ],
               onLoadSuccess:function(){
            	   
               }
	    };
	    $.table.init(options);
	}
	function lineWork()
	{
		var options = {
			id:"dg_work",
	        url: prefix + "/lineWork",
            uniqueId: "id",
            sortName: "address",
            sortOrder: "asc",
            modalName: "当日计划",
            pageSize:5,
            showSearch: false,
            showRefresh: false,
            showColumns: false,
            showToggle: false,
            columns: [
                {
                    title:'工作地点',
                    field: 'address'
                },
               {
                   title:'工作内容',
                   field: 'ccontent'
               }],
               onLoadSuccess:function(){
            	   
               }
	    };
	    $.table.init(options);
	}
	
	function bindData()
	{
		bindPlan();
		lineWork();
		$.table.search('','dg_plan');
	    layer.close(index);
	}
	
	function rowformater(value, row, index)
	{
		return "<a class='btn btn-success btn-xs' href='javascript:void(0)' onclick=openUrl('"+row.ctask_id+"','"+row.cwf_node_id+"','"+row.cwf_id+"','"+row.kind+"')>处理</a>";
	}
	//退回任务处理
	function rowformaterT(value, row, index)
	{
		return "<a class='btn btn-success btn-xs' href='javascript:void(0)' onclick=openWork('"+row.cprj+"','"+row.ctitle+"')>处理</a>";
	}
	
	function openWork(cprj,ctitle)//
	{
		
		//ctitle="";
		
		cprj=cprj.replace("#","?");
		var url="#(ctx)/"+cprj;
		//var url='#(ctx)/produce_edit?table=mis_work_temp&dotype=edit&id='+id;
		//showWinFullCall('编辑日计划',url,"");
		openTopFull(ctitle,url);
	}
	
	function openUrl(ctask_id, cwf_node_id, cwf_id,kind)
	{
		var url = "#(ctx)/sp_task?taskid="+ctask_id+"&nodeid="+cwf_node_id;
		if(kind=='bill')
		{
			url = "#(ctx)/workflow_deal?taskid="+ctask_id+"&wfid="+cwf_id+"&nodeid="+cwf_node_id;
	    	if(cwf_node_id=='E00001')
	    	{
	    		$.getJSON(prefix+'/getNodeUrl',{wfid:cwf_id,nodeid:cwf_node_id},function(result){
		    		url = "#(ctx)/"+result+"?id="+ctask_id+"&taskid="+ctask_id;
	    		 });
	    	}
		}
		window.location.href=url;
	}
	
    function deal(taskid,wfid,nodeid,nodetype,detail_url)
    {
    	var url = "#(ctx)/workflow_deal?taskid="+taskid+"&wfid="+wfid+"&nodeid="+nodeid;
    	
    	if(nodetype=='start')
    	{
    		url = "#(ctx)/"+detail_url+"?id="+taskid;
    	}
    	window.location.href=url;
 	}
    
    function openMore()
    {
    	$.modal.openTab('隐患查询','#(ctx)/run_trouble_lib?cflag=3')
    }
    function openMore_work()
    {
    	$.modal.openTab('工作计划执行','#(ctx)/produce_list_zx?dotype=zx')
    }
    function openTrouble(id)
    {
    	var url="#(ctx)/run_trouble_lib/edit?dotype=view&id="+id;
    	showWinFull("隐患",url);
    }

</script>
</body>
#end
